﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace tPlat
{
    public partial class Index : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void LoginFrom_Authenticate(object sender, AuthenticateEventArgs e)
        {
            HotelSystem system = (HotelSystem) Application["System"];
            User superUser = system.loginUser(LoginForm.UserName, LoginForm.Password);
            if (Convert.ToBoolean(superUser.getId()))
            {
                LoginForm.Visible = false;
                Session["Secured"] = true;
                Session["User"] = superUser; 
                if (superUser.getUsername() == "admin")
                {
                    Session["SuperUser"] = true;
                }
                else Session["SuperUser"] = false;
                Response.Redirect("Manager.aspx");
            }
        }
    }
}
